package com.hhkj.admin.sale.model.dopo;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.hhkj.admin.sale.domain.SaleWithdrawal;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.Date;

@EqualsAndHashCode(callSuper = true)
@Data
public class SaleWithdrawalDo extends SaleWithdrawal {
    /** 商家编号或者名称 **/
    private String sale;

    /** 销售编号或者名称 **/
    private String saleRoot;

    /** 提现日期-开始时间 **/
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date withdrawalDateStart;

    /** 提现日期-结束时间 **/
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date withdrawalDateEnd;

    /** 提交时间 开始日期 */
    private Date submitDateStart;

    /** 提交时间结束日期 */
    private Date submitDateEnd;

    public void setWithdrawalDateEnd(Date withdrawalDateEnd) {
        if (ObjectUtil.isNotEmpty(withdrawalDateEnd)) {
            this.withdrawalDateEnd = DateUtil.offsetMillisecond(DateUtil.offsetDay(withdrawalDateEnd, 1), -1);
        }
    }
}
